print("1. 左上直角三角形：")
row = 1
while row <= 5:
    col = 1
    while col <= 6 - row:  # 控制每行星号的数量
        print("*", end="")
        col += 1
    print()  # 换行
    row += 1

print("\n2. 右上直角三角形：")
row = 1
while row <= 5:
    # 先打印空格
    space = 1
    while space < row:
        print(" ", end="")
        space += 1
    # 再打印星号
    col = 1
    while col <= 6 - row:
        print("*", end="")
        col += 1
    print()
    row += 1

print("\n3. 左下直角三角形：")
row = 1
while row <= 5:
    col = 1
    while col <= row:
        print("*", end="")
        col += 1
    print()
    row += 1

print("\n4. 右下直角三角形：")
row = 1
while row <= 5:
    # 先打印空格
    space = 1
    while space <= 5 - row:
        print(" ", end="")
        space += 1
    # 再打印星号
    col = 1
    while col <= row:
        print("*", end="")
        col += 1
    print()
    row += 1